package com.shujia.day19.factorydemo;

public class AnimalFactory {
    private AnimalFactory() {
    }

    public static Animal createAnimal(String name){
        if("dog".equals(name)){
            return new Dog();
        }else if("cat".equals(name)){
            return new Cat();
        }else {
            System.out.println("没有该动物");
            return null;
        }
    }
}
